OK.
I did the followings;
class AppDelegate: NSObject, UIApplicationDelegate {
private var isTaskKilled = true
func applicationDidEnterBackground(_ application: UIApplication) {
isTaskKilled = false
}
func applicationWillEnterForeground(_ application: UIApplication) {
if isTaskKilled {
// Do something when task killed.
}
}
}
Post
Replies
Boosts
Views
Activity
Self resolved.
I found another method which does not require "applicationWillTerminate".
Thanks anyway.
Self-resolved.
It seems other push notifications are sent from APNs, which I did not know.
Sorry for disturbing you.
Thank you for your response.
Please let me tell you another additional information, which is, I use SwiftUI.
Please let me answer your questions as follow;
The following is the code I use;
private var context = LAContext()
public func checkBiometric() -> Future<Bool, Error> {
Future { [context] promise in
Task { [promise, context] in
context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics,
localizedReason: "Some reason") { success, error in
if success {
promise(.success(success))
} else {
promise(.failure(error as! LAError))
}
}
}
}
}
This is called right after lifecycle status becomes "active" from "background".
The test device is iPhone 13 pro with iOS 15.5, and Face ID.
If you need more information, please feel free to contact me.
Best regards,
Additional information,
Biometrics authentication works when first login to my iOS app.
Finish app and go to background
Activate app to get back from background. Biometrics authentication works but always returns "success"
It works fine at 1. operation because it is the very first Biometrics authentication.
On the other hand, it always returns "success" from 2nd trial.
If I terminate the app and re-activate it, Biometrics authentication works fine.
Therefore, I wonder if Biometrics authentication would not work correctly when get back from background.
ssmith_c,
sorry for my late response.
Thank you for your response.
Yes, I understand what you are saying and you are right.
I can get much better picture when I record a video, but can not get the same quality for a still picture. So, I think the problem shows when I shoot a still picture. The reason may be less light, though.
The following is a part of my code;
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...
if let url = URL(string: urlString) {
cell.imageView.sd_setImage(with: url, completed: { image, error, _, _ in
if let error = error {
print(error)
return
}
if let image = image {
let imageAspect = image.size.height / image.size.width
cell.imageViewHeightConstraint.constant = tableView.frame.width * imageAspect
tableView.reloadRows(at: [indexPath], with: .none)
}
})
}
...
}
I tried to call setNeedsLayout on the cell by replacing tableView.reloadRows(at: [indexPath], with: .none) with cell.setNeedsLayout(), it did not work.
Anyway, thank you for your information.
Self solved.
Self solved.
I powered off the iPhone 13 pro then powered up it, then did the same process. Xcode recognize iOS 15.2.
I do not understand why this power on/off work is required.
Additional information.
I tried the following code with iPhone 13 and 13 mini.
captureDevice = AVCaptureDevice.default(AVCaptureDevice.DeviceType.builtInUltraWideCamera, for: AVMediaType.video, position: .back)
if !captureDevice.isFocusModeSupported(.autoFocus) {
print("autoFocus not supported")
}
if !captureDevice.isFocusModeSupported(.continuousAutoFocus) {
print("continuousAutoFocus not supported")
}
if !captureDevice.isFocusModeSupported(.locked) {
print("locked not supported")
}
}
The result is all "not supported".
That means the ultra-wide camera has no focus mode. Does this mean "fixed focus"?
To Apple Support Team, please let me know if this is true.
Removed
Additional information, I tried the following code with iPhone 13 / 13 mini without checking "captureDevice.isFocusModeSupported(.autoFocus)";
do {
try captureDevice.lockForConfiguration()
captureDevice.focusMode = .autoFocus
captureDevice.unlockForConfiguration()
} catch _ {
}
The result is my app collapsed.
From this symptom, it seems the ultraWideCamera of iPhone 13 / 13 mini does not support "autoFocus", but iPhone 13 pro does.
Is this correct spec? or iOS 15 bug?